Repository navigation
fix(console): under draft preview the New record form draws a draft-only field and never writes it - #34843
Conversation
…only Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX
|
repo:objectstack#3 · os-support-ai · session_01WGufzhshTXCAmv9KJXRZkB L1 review · 2026-11-17T13:18ZL1: ACCEPT Read at this exact head: the 6 files (+575/−2), the body, card #34807, ruling 6946403206, Premise corrected 6946635368, claim 6946453254, and os-dev-report 6949123927. CI on this sha at review time: 49 runs. None had failed; Test UI (16 shards), Lint UI, Type Check UI, Build & E2E UI and most Lint/Type Check jobs were still in progress. The full app-shell suite is NOT MEASURED locally (the report says so). CI's Test UI is therefore the only whole-suite reading, and it must be green before landing. Landing condition (nit-only standard): S1 below is fixed and delta-reviewed, and the seat accepts the declared deviation (E1). Until both hold, this PR is not landable. Must-fixNone. Should-fix
Escalated to the seat
Checklist
Notes
|
plugin-form maps the underscore-private _draftOnly marker onto a field's disabled in ObjectForm and fromObjectSchema; the preview data source still leaves such fields out of every write. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX
… the write census Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX
|
repo:objectstack#3 · os-support-ai · session_01WGufzhshTXCAmv9KJXRZkB L1 delta review · 2026-11-17T14:16ZL1: REWORK This is a delta from my ACCEPT 6949215692 at CI on this sha at review time: 54 runs, none failed. Test UI (16 shards), Lint UI, Type Check UI and Build & E2E UI were still in progress. Must-fix
Should-fixNone. S1 from 6949215692 is fixed: the RecordFormPage comment now describes the drawn-disabled, write-stripped route and the raw-adapter Delta checklist
Notes
|
…e record form save Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX
…ly preview field Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX
|
repo:objectstack#3 · os-support-ai · session_01WGufzhshTXCAmv9KJXRZkB L1 delta review · 2026-11-17T15:27ZL1: ACCEPT This is a delta from my REWORK 6950630501 at CI on this sha was still in progress at review time. Land only once it is fully green. Must-fixNone. M1 is fixed.
Should-fixNone. Delta checklist
Notes
|
…aft-preview-form-list
|
repo:objectstack#3 · os-support-ai · session_01WGufzg2evNa1V3zxrQq3KX Landing · 2026-11-17T15:51Z · area o3-A
State:
|
…half The form-half files resolve to main's squash, which carries rounds 3 and 4. Claude-Session: https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX Co-authored-by: Claude <noreply@anthropic.com>
Requested by Yibo Wang · project thread
repo:objectstack#3 · os-support-ai · session_01WGufzg2evNa1V3zxrQq3KX
Part of #34807
Clause-②: no
Metadata-protocol: none
Premise corrected: 6946635368
Ruling-ref: 6946403206
Surface-amendment: 6949282066
Review-ref: 6950630501
This PR ships the form half of the card. The list half (a draft list column on a draft-only field gets the list query refused) stays on the card: the console list query is sent by
ListViewin@object-ui/plugin-list, outside this PR's surface, and the seat is deciding how it lands.维护者速读
?preview=draft)里,「新建记录」整页表单和全局新建/编辑弹窗现在会显示只存在于草稿中的字段(用草稿里的标签和定义),但该字段是灰的、不可填写,也不算必填(草稿里标了必填也不会挡住保存);保存时这些字段也不会写入记录。plugin-form只多认一个预览专用标记,没有标记的字段行为不变。回滚即 revert 本 PR。ui/packages/plugin-form/src/sectionFields.ts与ObjectForm.tsx(disabled那一行多了_draftOnly判断,影响已发布包);ui/packages/app-shell/src/utils/previewFormDataSource.ts(withDraftOnlyFields与代理的create/update剔除);ui/packages/app-shell/src/views/RecordFormPage.tsx(只换了传给表单的 dataSource)。pnpm --dir ui exec vitest run packages/app-shell/src/utils/previewFormDataSource.test.tsx packages/app-shell/src/views/RecordFormPage.draftPreview-34807.test.tsx packages/plugin-form/src/sectionFields.test.ts packages/plugin-form/src/ObjectForm.test.tsx,预期 4 个文件、70 个测试全部通过。What changes
ui/packages/app-shell/src/utils/previewFormDataSource.ts:withDraftOnlyFields(published, overlay): a copy of the published object document plus each field only the draft overlay declares, with its draft definition minusrequired/requiredWhen, and the marker_draftOnly: true(spelled in the module asDRAFT_ONLY_FIELD_KEY). A disabled control the form still requires would refuse every save over a field the viewer cannot fill (review 6950630501, M1). Fields the published document declares keep their published definition. The copy re-attaches the adapter's non-enumerable sortability projection withattachObjectSortability(a spread drops it). A draft-only object (published read answersMetadataNotFoundError) yields the overlay with every field marked; no overlay document returns the published one as is.readDraftPreviewObjectSchema(adapter, readOverlay, name): the overlay read (useMetadata().getItem('object', name), which reads through the?preview=draftclient in preview) over the adapter's publishedgetObjectSchema. Any published failure other than absence fails the read, as today.createPreviewFormDataSource(adapter, readOverlay): aProxyover the adapter whosegetObjectSchemaanswers the above and whosecreate/updateleave the draft-only names that answer marked out of the record they send (a safety net: the field is not fillable, but its declared default would otherwise ride along). Every other member is the adapter's own, bound to it once (stable identity).usePreviewFormDataSource(adapter): the adapter itself outside preview; the proxy inside it.@object-ui/plugin-form: thedisabledline inObjectForm'sgenerateFieldand in the shared object-schema field mappingfromObjectSchema(sectionFields.ts) gains|| field._draftOnly === true. InnormalizeSectionFielda form-view entry'srequiredno longer applies when the object-schema field carries_draftOnly: true(the view entry carries norequiredWhenon that path); the field stays disabled. The literal is spelled in each package; nothing new is exported.RecordFormPagepassesusePreviewFormDataSource(dataSource)toObjectForm;claimAnswerWarningskeeps the raw adapter. Its comment now says the draft-only field is drawn disabled and the proxy leaves it out of every create and update (review S1, 6949215692: fixed).AppContentpasses it to the globalLazyModalForm(call-site change only).affordanceGrantMap-12082.test.tsx(WRITE_SITES) gains the proxy'screateandupdateasdoor(...)entries, with the reason: it forwards the write its form hands it, minus draft-only field names.ModalForm,plugin-grid,plugin-list,preview/**orpackages/**. No new locale key.Why
Under
?preview=draftthe form's field names came from the draft-aware metadata provider, but its field definitions came from the adapter's publishedgetObjectSchema, which carries no preview flag;ObjectFormdraws only a name its definition declares, so a draft-only field was missing (premise reading 6946388533, corrected by the seat in 6946635368).Disabled, not readonly, and not editable-then-stripped (surface amendment 6949282066, route A). Preview stays read-only for data (ruling 6946403206, ADR-0037 Phase 1): a draft-only field does not exist in the published object the data door validates against, so it must never be written. A field drawn editable and then silently stripped was rejected by the seat. Marking the definition
readonly: truedoes not work: measured on this head,filterSystemFieldsin@object-ui/plugin-formdrops anyreadonly: truefield on create and edit, and a create form does not evaluatereadonlyWhen(readonlyWhen: isCreateForm ? undefined : readonlyWhenin the components form renderer), so a static lock hides the field the preview exists to show and a predicate lock does nothing. (Correction: an earlier revision of this body named that filterfilterCreateModeFields; the function isfilterSystemFields.) The renderer does honourFormField.disabledon create, soplugin-formmaps the marker todisabled.Disabled, therefore not required (review 6950630501, M1).
isRequiredInFormkeepsrequiredat both plugin-form mapping sites, the form renderer never lowersrequiredfor a disabled control, and react-hook-form still validates it, so a draft that adds a required field with no default made New refuse with "X is required" over a control the viewer cannot fill (reproduced: the ablation below). The marked copy therefore drops the field'srequiredandrequiredWhen, in app-shell. A form view could restaterequiredover the field (normalizeSectionFieldre-runsisRequiredInFormon the view entry's ownrequired, and under preview the form view comes from the draft object), so that restatement is skipped for a_draftOnlyfield insectionFields.ts(fix round 4, option A). The field's value rules (minLength,maxLength,min,max, and the email / url / location checks its type implies) are kept: they fire only on a value, and the only value a disabled draft-only control holds is its own draft default, so they could refuse only a draft whose default breaks its own rule.Deviation, declared.
_draftOnlyis an underscore-private convention between two of our packages (@object-ui/app-shellsets it,@object-ui/plugin-formreads it), not an authoring key: no spec schema, no metadata document and no author ever writes it, it is never persisted, and only the console's draft-preview proxy produces it. HenceClause-②: noandMetadata-protocol: none.Tests
ui/packages/plugin-form/src/sectionFields.test.ts: "a_draftOnlyfield maps to a disabled FormField": the marked field isdisabled; CONTROL: the same field unmarked is not. A form-view entry{ field: 'priority', required: true }over the marked field givesrequired: false,disabled: true; CONTROL: the same entry over an unmarked field givesrequired: true.ui/packages/plugin-form/src/ObjectForm.test.tsx: "ObjectForm draws a_draftOnlyfield disabled": through the realObjectForm, the marked field's input is disabled; CONTROL: the unmarked field stays editable.ui/packages/app-shell/src/utils/previewFormDataSource.test.tsx(17 tests): a required draft-only field (required: true, no default) and arequiredWhenone, through the realModalFormunder preview: both drawn disabled, Save goes through, the create has neither key;withDraftOnlyFieldsdropsrequired/requiredWhenfrom a draft-only field and keeps a published field'srequired; CONTROL outside preview: a required published field left empty still blocks Save (aria-invalid, no create). AlsowithDraftOnlyFields(marker, published definitions kept, inputs untouched, sortability projection survives, draft-only object, no overlay); the proxy (overlay answer, absence vs other failure,create/updatestrip,thisbinding / identity /instanceof); the hook (CONTROL: outside preview it is the adapter; in preview it readsgetItem('object', name)); the realModalFormunder preview: "Priority" visible and its input disabled, "Title" editable, Save's create payload hastitleand nopriority(its declared default is stripped too); CONTROL outside preview: onegetObjectSchema('tracker_task')call,getItemnever called, no "Priority".ui/packages/app-shell/src/views/RecordFormPage.draftPreview-34807.test.tsx(4 tests): the realRecordFormPage+ObjectFormunder preview with a required draft-only field: drawn disabled, Save goes through, the create leaves it out. With a draft form view whose section restates{ field: 'due_note', required: true }on the draft-only field: drawn disabled, Save goes through, the create leaves it out. Also the realRecordFormPage+ObjectFormunder preview: "Priority" visible and disabled, absent from the create; CONTROL outside preview: one published read (objectui#13044), no overlay read, no draft field.Pinned files plus the census, head 75e7773
Ablation (one-shot, restored): the form-view required skip removed from normalizeSectionField
Committed first (75e7773);
node scripts/ablation-replace.mjsreplacedif (fd.required != null && !draftOnly) {withif (fd.required != null) {(anchor x1 to x0, blob f1a74df5666d to 199e51e13a0e), ransectionFields.test.ts,RecordFormPage.draftPreview-34807.test.tsxandpreviewFormDataSource.test.tsx, restored.The CONTROL (the same view entry over an unmarked field stays required) stayed green under the mutation.
Ablation (one-shot, restored): the required drop reverted in withDraftOnlyFields
Committed first (1bb765d);
node scripts/ablation-replace.mjsput back the pre-fix copy,fields[name] = { ...def, [DRAFT_ONLY_FIELD_KEY]: true };for{ ...drawn, ... }(anchor x1 to x0, blob 7795004bb009 to 96c69503085d), ran the two app-shell files, restored.The outside-preview CONTROL (a required published field still blocks) stayed green under the mutation.
Ablation (one-shot, restored): the marker dropped from the plugin-form field mapping
Committed first (03c259d);
node scripts/ablation-replace.mjsremoved|| field._draftOnly === truefromfromObjectSchemainsectionFields.ts(anchor x1 to x0, blob 0775f5a75bf2 to 69e117962018), ransectionFields.test.tsandpreviewFormDataSource.test.tsx, restored.The unmarked CONTROLs and the outside-preview CONTROLs stayed green under the mutation. An earlier ablation (head 1f10163) reverted the proxy's
getObjectSchemato the adapter's read: 6 failed | 10 passed, restored blob == HEAD.Write census: red, then green
At 03c259d CI's Test UI failed
affordanceGrantMap-12082.test.tsx> "every write site in the tree has an entry, and every entry is a site in the tree" (the proxy'screate/updatewere unlisted). Reproduced locally in the targeted run:Tests 1 failed | 3405 passed | 1 skipped (3407), the one failure being that test. After the twodoor(...)entries: that fileTests 55 passed (55), VERDICT command-exit 0; committed as 9719bf9.Acceptance notes
submitHandler(notdataSource.create/update) is not covered by the payload strip; the field is still drawn disabled there if that form maps throughfromObjectSchema; no draft-only path into it was found, not measured.RecordFormPageturns every query-string entry into a create prefill, so on a New page under?preview=draftthe pairpreview=draftbecomes a prefill value; the write sanitizer drops it as an unknown key unless the object declares a field namedpreview.Verification
Targeted run, head 03c259d: all of packages/plugin-form/ plus every app-shell test file that imports RecordFormPage, AppContent or the new helper, and the 13044 one-read pin
The one failure was the write census, fixed in 9719bf9 (see above). Declared narrowing: the full
packages/app-shell/suite ran over 40 minutes on the shared box earlier and was stopped by me before a verdict; it is NOT MEASURED locally and left to CI's Test UI.Type-check and lint
Derived gate families (dispatch-gates --commands, 38), --ran reconciliation
Re-derived at 75e7773: the same 38 families. Re-run on 75e7773 (the families reading the changed changeset, source and test files):
check-empty-changeset,check-adr-0087-registration,check-changeset-no-major,check:nul-bytes,check:cross-package-test-inputs,check:undeclared-dep-imports,check:type-check-coverage,check:test-source-alias,check-sdui-manifest,check:skill-identifier-liveness, all exit 0;check:new-line-citations0 new. Earlier, at 9719bf9: All 38 exited 0 (run over 03c259d plus the census entry;pnpm --dir ui exec vitest run scripts/first missed the lock, exit 99, and was re-run:Test Files 171 passed | 2 skipped (173),Tests 5077 passed | 2 skipped (5079), VERDICT command-exit 0).dispatch-gates --ran: 38 derived, 38 run, 0 NOT-MEASURED (a derived zero: all 38 recorded an exit code).pnpm --workspace-concurrency=2 --filter '@object-ui/app-shell^...' build, VERDICT command-exit 0.node scripts/pm/overlap-check.mjs --branch=claude/issue-34807-draft-preview-form-list, alone before every push: VERDICT clean exit 0 (last: 75e7773 vs origin/main fc5913e and PR feat(studio): switch an installed app's action on or off on the action, in Studio; retire Setup's Packaged Actions #34799, which sharesAppContent.tsx, merges cleanly)..changeset/34807-draft-preview-form-fields.md:@object-ui/app-shellpatch and@object-ui/plugin-formpatch.com.example.trackerunder?preview=draft; theAppContentmodal call site rendered inside the full console (the hook and the realModalFormare pinned together, the call site itself is a one-prop change); the full app-shell suite (CI); dogfood (n/a: no!in the title, no narrowing arm).Human Minimum
packages/specholds no runtime logic.pnpm lintpasses. (No formatter ran. eslint on the changed files: 0 errors; the repo-widepnpm lintis CI's, not measured locally.)main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (not touched)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX
Generated by Claude Code